home *** CD-ROM | disk | FTP | other *** search
Oberon Text | 1993-10-25 | 1.4 KB | 35 lines | [.Ob./.Ob5] |
- Syntax10.Scn.Fnt
- Syntax10i.Scn.Fnt
- MODULE Automatic; (* Michael Franz, 3.11.90 / 18.2.93 *)
- A simple macro facility for executing several commands in succession.
- Position the Star Marker in this viewer (Enter on Keypad)
- Compiler.Compile *
- Sample Activation:
- Automatic.Do
- System.Directory *.Mod
- System.ShowCommands System ~
- Browser.ShowDef TextFrames ~
- IMPORT
- Texts, Oberon;
- W: Texts.Writer;
- PROCEDURE NextLine(text: Texts.Text; pos: LONGINT): LONGINT;
- VAR R: Texts.Reader; ch: CHAR;
- BEGIN
- IF pos < text.len THEN Texts.OpenReader(R, text, pos); Texts.Read(R, ch);
- WHILE ~R.eot & (ch#0DX) DO Texts.Read(R, ch) END;
- IF R.eot THEN RETURN -1 ELSE RETURN Texts.Pos(R) END
- ELSE RETURN -1 END
- END NextLine;
- PROCEDURE Do*;
- VAR S: Texts.Scanner; res: INTEGER;
- BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
- WHILE S.class=Texts.Name DO Oberon.Par.pos:=Texts.Pos(S)-1;
- Texts.WriteString(W, "Auto> "); Texts.WriteString(W, S.s); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf);
- Oberon.Call(S.s, Oberon.Par, FALSE, res); Oberon.Par.pos:=NextLine(Oberon.Par.text, Oberon.Par.pos);
- IF Oberon.Par.pos > 0 THEN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S)
- ELSE S.class:=Texts.Inval END
- END
- END Do;
- BEGIN Texts.OpenWriter(W)
- END Automatic.
-